package cn.hyatt.core.entity;

import cn.hyatt.common.utils.DateTimeUtil;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 基础实体类
 *
 * @author hyatt
 */
@Getter
@Setter
public class BaseEntity implements Serializable {

    @Serial
    private static final long serialVersionUID = 42L;

    @TableId(type = IdType.ASSIGN_ID)
    @Schema(name = "主键Id")
    private Long id;

    @TableField(value = "create_by",fill = FieldFill.INSERT)
    @Schema(name = "创建者")
    private Long createBy;

    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @JsonFormat(pattern = DateTimeUtil.COMMON_DATE_TIME_FORM)
    @Schema(name = "创建时间")
    private LocalDateTime createTime;

    @TableField(value = "update_by",fill = FieldFill.INSERT_UPDATE)
    @Schema(name = "更新者")
    private Long updateBy;

    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = DateTimeUtil.COMMON_DATE_TIME_FORM)
    @Schema(name = "更新时间")
    private LocalDateTime updateTime;

}
